﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace NewGlobalBizAssist
{
    public partial class DirectSummary : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btn_Click(object sender, EventArgs e)
        {
            string sql = @"SELECT        AgentID, Agent, SUM(Amount) AS Amount
FROM            vwMemberLevel
GROUP BY AgentID, Agent, CLevel
HAVING        (CLevel = 1)";
            gvMembers.DataSource = new Lib.DataAccess().GetDataSet(sql);
            gvMembers.DataBind();

        }

        protected void gv_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            // Make sure the current GridViewRow is a data row. 
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                // Make sure the current GridViewRow is either  
                // in the normal state or an alternate row. 
                if (e.Row.RowState == DataControlRowState.Normal || e.Row.RowState == DataControlRowState.Alternate)
                {
                    // Add client-side confirmation when deleting. 
                    //((HyperLink)e.Row.Cells[0].Controls[1]).Attributes["onclick"] = "$( \"#dialog-form\" ).dialog( \"open\" );";
                    ((HyperLink)e.Row.Cells[0].Controls[1]).NavigateUrl = "javascript:openDetail('" + ((HyperLink)e.Row.Cells[0].Controls[1]).Text + "');";

                    //((HyperLink)e.Row.Cells[0].Controls[1]).NavigateUrl = "~/DirectSummaryDet.aspx?ID=" + ((HyperLink)e.Row.Cells[0].Controls[1]).Text;
                }
            }
        }
    }
}